package org.example.myleet.rosalind.indc;

import org.example.myleet.rosalind.utils.BigNumberOperator;

import java.math.BigDecimal;

public class Solution {
    public static void main(String[] args) {
        int n = 5;
//        int n = 42;
        BigDecimal[] probabilities = new BigDecimal[2 * n];
        BigDecimal p = BigDecimal.valueOf(0.5).pow(2 * n);
        BigDecimal prev = BigDecimal.ONE;
        probabilities[2 * n - 1] = prev.multiply(p);
        for (int k = 2 * n - 1; k > 0; --k) {
            BigDecimal combination = new BigDecimal(BigNumberOperator.combination(2 * n, k).toString());
            probabilities[k - 1] = probabilities[k].add(combination.multiply(p));
        }
        for (int k = 1; k <= 2 * n; ++k) {
            System.out.printf("%s ", BigNumberOperator.log10(probabilities[k - 1], 5).toPlainString());
        }
        System.out.println();
    }
}
